package xman.mssh.spring;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class SpringContextManual {
    
    static Logger logger = LoggerFactory.getLogger(SpringContextManual.class);
    
    protected ApplicationContext context = new FileSystemXmlApplicationContext("classpath:spring/spring-conf.xml"
    // "file:" + SpringContextManual.class.getResource("/").getFile()
    );
    
    /**
     * ClassPathXmlApplicationContext classpath:前缀是不需要的, 默认就是指项目的classpath路径下面; 如果要使用绝对路径,需要加上 file:前缀表示这是绝对路径
     * 
     * FileSystemXmlApplicationContext 默认表示的是两种： 1,没有盘符的是 ,项目工作路径， 即项目的根目录;2,有盘符表示的是 ,文件绝对路径 如果要使用classpath路径, 需要前缀
     * classpath:
     */
    
    @Test
    public void stdout() throws Exception {
        SpringBeanDemo demo = (SpringBeanDemo) context.getBean(SpringBeanDemo.class);
        demo.outString();
        logger.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        demo.joinPointCut();
    }
}
